package space.panker916.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import space.panker916.pojo.User;

/**
 * @program: niit-spring
 * @description:
 * @author: PanKer
 * @create: 2022-04-18 22:26
 */
@Mapper
@Repository
public interface UserMapper {
    @Insert("INSERT INTO user(username, password) " +
            "VALUES(#{username}, #{password});")
    @Options(useGeneratedKeys = true)
    int insertUser(User user);

    @Update("UPDATE user SET " +
            "username = #{username}, " +
            "password = #{password} " +
            "WHERE id = #{id};")
    int updateUser(User user);
}
